package handler.server;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

/**
 * @author dfj@99chuxing.com
 * @date 2018/4/4 0004 12:55
 * 服务端编码器，对出站数据进行编码
 */
public class ServerEncoder extends MessageToByteEncoder<String>{



    @Override
    protected void encode(ChannelHandlerContext channelHandlerContext, String s, ByteBuf byteBuf) throws Exception {
        System.out.println("编码器对出站数据进行编码------------");
        byteBuf.writeBytes(s.getBytes());
    }
}
